home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / asm / utils / hunk / hunk.s < prev    next >
Text File  |  1980-01-03  |  13KB  |  686 lines

  1. CALLDOS    MACRO
  2.     move.l    DosBase(pc),a6
  3.     jsr    _LVO\1(a6)
  4.     ENDM
  5.  
  6. CALLEXEC MACRO
  7.     move.l    $4.w,a6
  8.     jsr    _LVO\1(a6)
  9.     ENDM
  10.  
  11.     include    "df0:include/exec/exec_lib.i"
  12.     include    "df0:include/dos/dos.i"
  13.     include    "df0:include/dos/doshunks.i"
  14.     include    "df0:include/dos/dos_lib.i"
  15.  
  16.     move.l    sp,StartStack        save initial sp for quick exit
  17.  
  18.     clr.b    -1(a0,d0.l)        Null terminate command line
  19.     move.l    a0,-(sp)        Save CLI command
  20.  
  21.     lea    DosName(pc),a1        open dos.library
  22.     CALLEXEC OldOpenLibrary
  23.     tst.l    d0
  24.     beq.s    NoDos
  25.     move.l    d0,DosBase
  26.  
  27.     CALLDOS    Output            Get CLI output file handle
  28.     move.l    d0,HandleOut
  29.  
  30.     move.l    (sp)+,a0
  31.     bsr    ParseCLI        CLI call, so parse command line
  32.     beq.s    exit            Bad CLI command ?
  33.  
  34.     bsr    _main
  35.  
  36. exit    move.l    FileHandle(pc),d0    Check for open file
  37.     beq.s    .NoCloseFile
  38.  
  39.     move.l    FileHandle(pc),d1    Free read access on file
  40.     CALLDOS    Close
  41.     clr.l    FileHandle
  42.  
  43. .NoCloseFile
  44.     move.l    DosBase(pc),a1        Close dos.library
  45.     CALLEXEC CloseLibrary
  46.  
  47. NoDos    move.l    StartStack(pc),sp
  48.     moveq    #0,d0
  49.     rts
  50.  
  51.  
  52. _main    move.l    d0,FileName
  53.     lea    Title(pc),a0
  54.     bsr    printf
  55.  
  56.     move.l    FileName(pc),d1        Get size of input file
  57.     move.l    #MODE_OLDFILE,d2
  58.     CALLDOS    Open
  59.     move.l    d0,FileHandle
  60.     beq    ErrNoFile
  61.     move.l    d0,d1
  62.     moveq    #OFFSET_END,d3
  63.     moveq    #0,d2
  64.     CALLDOS    Seek        Seek to end of file
  65.     move.l    FileHandle(pc),d1
  66.     moveq    #0,d2
  67.     moveq    #OFFSET_BEGINNING,d3
  68.     CALLDOS    Seek        Seek to beginning of file + retrun file length
  69.     move.l    d0,FileSize
  70.  
  71.  
  72. NewHunk    clr.l    HunkNumber
  73. HunkEnd    clr.b    SameHunk
  74.  
  75. NextHunk
  76.     move.l    FilePos(pc),d0        Check for end of file
  77.     cmp.l    FileSize(pc),d0
  78.     bcc    FileEnd
  79.  
  80.     bsr    ReadLong
  81.     move.l    d0,d7            save hunk type for later
  82.  
  83.     move.b    SameHunk(pc),d1
  84.     bne.s    .NoForceMem
  85.  
  86.     cmp.w    #HUNK_HEADER,d0
  87.     beq.s    .NoForceMem
  88.     cmp.w    #HUNK_UNIT,d0
  89.     beq.s    .NoForceMem
  90.     cmp.w    #HUNK_BREAK,d0
  91.     beq.s    .NoForceMem
  92.  
  93.     move.l    sp,Stack
  94.  
  95.     swap    d0
  96.     and.l    #$ffff,d0
  97.     lea    ToChipMsg(pc),a0    check for hunk forced to memory type
  98.     cmp.w    #$4000,d0
  99.     beq.s    .DispHunk
  100.     lea    ToFastMsg(pc),a0
  101.     cmp.w    #$8000,d0
  102.     beq.s    .DispHunk
  103.     lea    BlankMsg(pc),a0    
  104.     tst.w    d0
  105.     beq.s    .DispHunk
  106.     move.l    d0,-(sp)        unknown hunk, so display type
  107.     lea    ForceMsg(pc),a0    
  108. .DispHunk
  109.  
  110.     move.l    a0,-(sp)        disp 'Hunk 0:' file postion, mem type
  111.     move.l    FilePos(pc),-(sp)
  112.     move.l    HunkNumber(pc),-(sp)
  113.     lea    HunkMsg(pc),a0
  114.     bsr    printf
  115.     move.l    Stack(pc),sp        correct stack
  116.  
  117.     addq.l    #1,HunkNumber
  118.     st    SameHunk        set new hunk flag
  119.  
  120. .NoForceMem
  121.     move.l    d7,d0            parse file on hunk type
  122.     cmp.w    #HUNK_UNIT,d0
  123.     beq    HunkUnit
  124.     cmp.w    #HUNK_NAME,d0
  125.     beq    HunkName
  126.     cmp.w    #HUNK_CODE,d0
  127.     beq    HunkCode
  128.     cmp.w    #HUNK_DATA,d0
  129.     beq    HunkData
  130.     cmp.w    #HUNK_BSS,d0
  131.     beq    HunkBss
  132.     cmp.w    #HUNK_RELOC32,d0
  133.     beq    HunkReloc32
  134.     cmp.w    #HUNK_RELOC16,d0
  135.     beq    HunkReloc16
  136.     cmp.w    #HUNK_RELOC8,d0
  137.     beq    HunkReloc8
  138.     cmp.w    #HUNK_EXT,d0
  139.     beq    HunkExt
  140.     cmp.w    #HUNK_SYMBOL,d0
  141.     beq    HunkSymbol
  142.     cmp.w    #HUNK_DEBUG,d0
  143.     beq    HunkDebug
  144.     cmp.w    #HUNK_END,d0
  145.     beq    HunkEnd
  146.     cmp.w    #HUNK_HEADER,d0
  147.     beq    HunkHeader
  148.     cmp.w    #HUNK_OVERLAY,d0
  149.     beq    HunkOverlay
  150.     cmp.w    #HUNK_BREAK,d0
  151.     beq    HunkBreak
  152.  
  153.     lea    BadHunkMsg(pc),a0    Not an object or executable
  154.     move.l    FilePos(pc),-(sp)    file offset
  155.     move.l    d0,-(sp)        bad HUNK id
  156.     bsr    printf
  157.     bra    exit
  158.  
  159. FileEnd    lea    EndUnit(pc),a0
  160.     bra    printf
  161.  
  162. HunkUnit
  163.     lea    HunkUnitMsg(pc),a0
  164.     bra.s    GetName
  165.  
  166. HunkName
  167.     lea    HunkNameMsg(pc),a0
  168. GetName    bsr    ReadLong
  169.     bsr    ReadD0Longs
  170.     pea    DiskBuffer(pc)
  171.     move.l    a0,-(sp)
  172.     lea    NameMsg(pc),a0
  173.     bsr    printf
  174.     addq.w    #8,sp
  175.     bra    NextHunk
  176.  
  177. HunkUnitMsg    dc.b    "Progam Unit",0
  178. HunkNameMsg    dc.b    "    Hunk Name",0
  179. CodeMsg        dc.b    "Code",0
  180. DataMsg        dc.b    "Data",0
  181. BssMsg        dc.b    "Bss",0
  182. DebugMsg    dc.b    "Debug",0
  183.     even
  184. HunkDebug
  185.     lea    DebugMsg(pc),a0
  186.     bra.s    HunkCodeData
  187. HunkCode
  188.     lea    CodeMsg(pc),a0
  189.     bra.s    HunkCodeData
  190. HunkData
  191.     lea    DataMsg(pc),a0
  192. HunkCodeData
  193.     bsr    ReadLong
  194.     bsr    SkipD0Longs
  195. BssBit    lsl.l    #2,d0
  196.     move.l    d0,-(sp)
  197.     move.l    a0,-(sp)
  198.     lea    HunkCodeDataMsg(pc),a0
  199.     bsr    printf
  200.     addq.w    #8,sp
  201.     bra    NextHunk
  202.  
  203. HunkBss    lea    BssMsg(pc),a0
  204.     bsr    ReadLong
  205.     bra.s    BssBit
  206.  
  207. HunkReloc8
  208.     lea    HunkReloc8Msg(pc),a4
  209.     bra.s    RelocJn
  210. HunkReloc16
  211.     lea    HunkReloc16Msg(pc),a4
  212.     bra.s    RelocJn
  213. HunkReloc32
  214.     lea    HunkReloc32Msg(pc),a4
  215. RelocJn    bsr    ReadLong
  216.     move.l    d0,d1
  217.     beq    NextHunk
  218.     bsr    ReadLong
  219.     move.l    d1,-(sp)        d1 = number of relocs
  220.     move.l    d0,-(sp)        d0 = reference section
  221.     move.l    a4,-(sp)
  222.     lea    HunkRelocMsg(pc),a0
  223.     bsr    printf
  224.     lea    8(sp),sp
  225.  
  226.     move.l    (sp)+,d0        advance past reloc section
  227.     bsr    SkipD0Longs
  228.     bra.s    HunkReloc32
  229.  
  230. HunkSymbol
  231.     lea    HunkSymbolMsg(pc),a0
  232.     bra.s    SymCont
  233.  
  234. HunkExt    lea    HunkExtMsg(pc),a0
  235. SymCont    bsr    printf
  236.  
  237. NxSymbol
  238.     bsr    ReadLong
  239.     move.l    d0,d1
  240.     beq    NextHunk
  241.     rol.l    #8,d1            d1 = symbol type
  242.     and.l    #$ffffff,d0        d0 = symbol length
  243.     bsr    ReadD0Longs        read symbol name
  244.  
  245.     cmp.b    #EXT_RES+1,d1
  246.     bcs.s    ExtDefinition
  247.     cmp.b    #EXT_COMMON,d1
  248.     beq.s    ExtCommon
  249.     bsr    ReadLong
  250.     bsr    SkipD0Longs
  251.  
  252.     move.b    ShowSymbols(pc),d2    display symbol ?
  253.     beq.s    NxSymbol
  254.  
  255.     moveq    #32,d2            assume 32 bit reference
  256.     cmp.b    #EXT_REF32,d1
  257.     beq.s    .GotSiz
  258.     moveq    #16,d2            assume 16 bit reference
  259.     cmp.b    #EXT_REF16,d1
  260.     beq.s    .GotSiz
  261.     moveq    #8,d2            must be 8 bit reference
  262. .GotSiz    pea    DiskBuffer(pc)        yes
  263.     move.l    d2,-(sp)
  264.     move.l    d0,-(sp)
  265.     lea    ExtRefMsg(pc),a0
  266.     bsr    printf
  267.     lea    12(sp),sp
  268.     bra.s    NxSymbol
  269.  
  270. ExtCommon
  271.     bsr    ReadLong
  272.     move.l    d0,-(sp)        Size of common block
  273.     bsr    ReadLong
  274.     move.l    d0,-(sp)        Count of references
  275.     bsr    SkipD0Longs
  276.     pea    DiskBuffer(pc)        Symbol name
  277.  
  278.     lea    ExtCommonMsg(pc),a0
  279.     move.b    ShowSymbols(pc),d0
  280.     beq.s    .NoSyms
  281.     bsr    printf
  282. .NoSyms    lea    12(sp),sp
  283.     bra.s    NxSymbol
  284.  
  285. ExtDefinition
  286.     bsr    ReadLong
  287.     move.b    ShowSymbols(pc),d1    Show symbol ?
  288.     beq    NxSymbol
  289.  
  290.     move.l    d0,-(sp)        Symbol value
  291.     pea    DiskBuffer(pc)
  292.     lea    ExtDefintionMsg(pc),a0
  293.     bsr    printf
  294.     addq.w    #8,sp
  295.     bra    NxSymbol
  296.  
  297.  
  298. HunkHeader
  299.     lea    HunkHeaderMsg(pc),a0
  300.     bsr    printf
  301. .NxLib    bsr    ReadLong
  302.     tst.l    d0
  303.     beq.s    .EndLibs
  304.     bsr    ReadD0Longs
  305.     pea    DiskBuffer(pc)
  306.     lea    LibNameMsg(pc),a0
  307.     bsr    printf
  308.     addq.w    #4,sp
  309.     bra.s    .NxLib
  310.  
  311. .EndLibs
  312.     bsr    ReadLong
  313.     move.l    d0,-(sp)
  314.     lea    TableMsg(pc),a0
  315.     bsr    printf
  316.     bsr    ReadLong
  317.     move.l    d0,HunkNumber
  318.     bsr    ReadLong
  319.     move.l    d0,-(sp)        d0 = Last hunk number
  320.  
  321.     sub.l    HunkNumber(pc),d0
  322.     addq.l    #1,d0            d0 = number of hunks
  323.  
  324.     bsr    SkipD0Longs
  325.  
  326.     move.l    HunkNumber(pc),-(sp)
  327.     lea    TableRange(pc),a0
  328.     bsr    printf
  329.     lea    12(sp),sp
  330.     bra    NextHunk
  331.  
  332. HunkOverlay
  333.     bsr    ReadLong
  334.     move.l    d0,d1
  335.     bsr    ReadLong
  336.     subq.l    #2,d0
  337.     move.l    d0,-(sp)
  338.     move.l    d1,-(sp)
  339.     move.l    d1,d0
  340.     bsr    SkipD0Longs
  341.     lea    HunkOverlayMsg(pc),a0
  342.     bsr    printf
  343.     addq.w    #8,sp
  344.     bra    NewHunk
  345.  
  346. HunkBreak
  347.     lea    HunkBreakMsg(pc),a0
  348.     bsr    printf
  349.     bra    NewHunk
  350.  
  351. ************    Execute given CLI commands (a0) = line to parse
  352. * ParseCLI *
  353. ************    returns d0=ptr to command name. d0=0, bad CLI command
  354. ParseCLI
  355.     move.l    a0,a1
  356.  
  357. .NxChr    move.b    (a1)+,d0        Parse CLI command
  358.     beq.s    BadCLI
  359.     cmp.b    #" ",d0            Ignore spaces
  360.     beq.s    .NxChr
  361.     cmp.b    #"    ",d0
  362.     beq.s    .NxChr
  363.     cmp.b    #"-",d0
  364.     beq.s    .Option
  365.     lea    -1(a1),a0        a0 = start of filename
  366.  
  367. .ToEnd    move.b    (a1)+,d0        search for next space & null terminate
  368.     beq.s    .EndTx
  369.     cmp.b    #" ",d0
  370.     beq.s    .EndTx
  371.     cmp.b    #"    ",d0
  372.     bne.s    .ToEnd
  373. .EndTx    clr.b    -(a1)
  374.     move.l    a0,d0
  375.     rts
  376.  
  377. .Option    move.b    (a1)+,d0
  378.     cmp.b    #" ",d0
  379.     beq.s    .NxChr
  380.     cmp.b    #"    ",d0
  381.     beq.s    .NxChr
  382.     cmp.b    #"s",d0
  383.     bne.s    BadCLI
  384.     st    ShowSymbols
  385.     bra.s    .Option
  386.  
  387. UnknownOpt
  388.     move.l    d0,-(sp)
  389.     lea    BadOptMsg(pc),a0
  390.     bsr    printf
  391.     addq.w    #4,sp
  392. BadCLI    lea    BadCLIMsg(pc),a0
  393.     bsr    printf
  394.  
  395.     moveq    #0,d0            exit - error
  396.     rts
  397.  
  398. **************    Check whether ctrl + C has been hit - quits program if so
  399. * CheckCTRLc *
  400. **************
  401. CheckCTRLc
  402.     move.l    a0,-(sp)
  403.     moveq    #0,d0
  404.     moveq    #0,d1
  405.     CALLEXEC SetSignal
  406.     and.l    #SIGBREAKF_CTRL_C,d0
  407.     bne.s    .CTRLcHit
  408.     move.l    (sp)+,a0
  409.     rts
  410. .CTRLcHit
  411.     bsr.s    ResetCTRLc
  412.     lea    BreakMsg(pc),a0
  413.     bsr    print
  414.     bra    exit
  415.  
  416. **************    Reset the CTRL + C pressed flag
  417. * ResetCTRLc *
  418. **************
  419. ResetCTRLc
  420.     moveq    #0,d0
  421.     move.l    #SIGBREAKF_CTRL_C,d1
  422.     CALLEXEC SetSignal
  423.     rts
  424.  
  425. *********  Sends string (a0), (a3-a0-1) bytes long to the screen
  426. * Write *
  427. *********
  428. Write    move.l    a0,d2
  429.     move.l    a3,d3
  430.     sub.l    a0,d3
  431.     subq.l    #1,d3
  432.     move.l    HandleOut(pc),d1
  433.     CALLDOS    Write
  434.     rts
  435.  
  436. ************ writes character d0 to screen
  437. * printchr *
  438. ************
  439. printchr
  440.     move.l    a3,-(sp)
  441.     lea    PrintBuffer(pc),a0
  442.     move.l    a0,a3
  443.     move.b    d0,(a3)+
  444.     clr.b    (a3)+
  445.     bsr    Write
  446.     move.l    (sp)+,a3
  447.     rts
  448.  
  449. ************ converts d0 to hexadecimal ascii chars & displays them
  450. * printhex *
  451. ************
  452. printhex
  453.     moveq    #0,d3        d3 = 0, ignore leading spaces
  454.     move.l    a3,-(sp)
  455.     lea    PrintBuffer(pc),a0
  456.     move.l    a0,a3
  457.     moveq    #7,d1
  458. .DoHex    rol.l    #4,d0
  459.     move.l    d0,d2
  460.     and.l    #$f,d2
  461.     bne.s    .PrtChr
  462.     tst.w    d3        got a zero to print, so check if leading 0
  463.     beq.s    .NoChr
  464. .PrtChr    moveq    #-1,d3
  465.     move.b    Hex2Ascii(pc,d2.w),(a3)+
  466. .NoChr    dbra    d1,.DoHex
  467.  
  468.     tst.w    d3        check for number = 0
  469.     bne.s    .NumNot0
  470.     move.b    #"0",(a3)+
  471. .NumNot0
  472.     clr.b    (a3)+
  473.     bsr.s    Write
  474.     move.l    (sp)+,a3
  475.     rts
  476. Hex2Ascii    dc.b    "0123456789ABCDEF"
  477. PrintBuffer    ds.b    20
  478.  
  479. nums    dc.l    100000000,10000000,1000000,100000,10000,1000,100,10,1,-1
  480.  
  481. ************    writes number d0 to screen leading zeros are omitted
  482. * printdec *
  483. ************
  484. printdec
  485.     movem.l    a3/d6/d7,-(sp)
  486.     lea    PrintBuffer(pc),a3
  487.  
  488.     moveq    #0,d7            d7 = 1, include zeros
  489.     lea    nums(pc),a0
  490.  
  491. NextDivisor
  492.     move.l    (a0)+,d1
  493.     bmi.s    NumberDone
  494.  
  495.     moveq    #"0",d6
  496. CompareAgain
  497.     cmp.l    d1,d0
  498.     blt.s    NoSubtract
  499.     addq.w    #1,d6
  500.     sub.l    d1,d0
  501.     moveq    #1,d7
  502.     bra.s    CompareAgain
  503. NoSubtract
  504.     tst.w    d7
  505.     beq.s    NextDivisor
  506.     move.b    d6,(a3)+        Add digit to display buffer
  507.     bra.s    NextDivisor
  508. NumberDone
  509.     tst.w    d7
  510.     bne.s    NumberNot0
  511.     move.b    #"0",(a3)+
  512. NumberNot0
  513.     clr.b    (a3)+
  514.     lea    PrintBuffer(pc),a0
  515.     bsr    Write
  516.     movem.l    (sp)+,a3/d6/d7
  517.     rts
  518.  
  519. NumberBuffer    ds.b    10
  520.  
  521.  
  522. **********  writes string (a0) to screen. Parameters need to be pushed onto
  523. * printf * the stack in the reverse order of usage
  524. **********
  525. printf    bsr    CheckCTRLc
  526.     lea    4(a7),a4    a4 points to first parameter
  527. print    move.l    a0,a3
  528. .ScanTx    move.b    (a3)+,d0    search for end of line, or parameter
  529.     beq    Write
  530.     cmp.b    #"%",d0
  531.     bne.s    .ScanTx
  532.     bsr    Write
  533.     move.b    (a3)+,d0    d0 = printf parameter command
  534.     move.l    a3,a0
  535.     cmp.b    #"%",d0
  536.     bne.s    .NotPct
  537.     subq.w    #1,a0
  538.     bra.s    .ScanTx
  539. .NotPct    cmp.b    #"c",d0
  540.     bne.s    .NotChr
  541.     move.l    (a4)+,d0    %c - write character to screen
  542.     bsr    printchr
  543.     move.l    a3,a0
  544.     bra.s    .ScanTx
  545. .NotChr    cmp.b    #"d",d0
  546.     bne.s    .NotDec
  547.     move.l    (a4)+,d0    %d - write decimal number to screen
  548.     bsr    printdec
  549.     move.l    a3,a0
  550.     bra.s    .ScanTx
  551. .NotDec    cmp.b    #"s",d0
  552.     bne.s    .NotStr
  553.     move.l    a3,-(sp)    %s - write string to screen
  554.     move.l    (a4)+,a0
  555.     bsr    print
  556.     move.l    (sp)+,a3
  557.     move.l    a3,a0
  558.     bra.s    .ScanTx
  559. .NotStr    cmp.b    #"x",d0        %x - write hexadecimal
  560.     bne    Write
  561.     move.l    (a4)+,d0
  562.     bsr    printhex
  563.     move.l    a3,a0
  564.     bra.s    .ScanTx
  565.  
  566. ErrNoFile
  567.     lea    NoFileMsg(pc),a0
  568.     move.l    FileName(pc),-(sp)
  569.     bsr    printf
  570.     addq.w    #4,sp
  571.     bra    exit
  572. ErrNoMem
  573.     lea    NoMemMsg(pc),a0
  574. ErrJn    bsr    printf
  575.     bra    exit
  576.  
  577. ErrRead    lea    BadReadMsg(pc),a0
  578.     bra.s    ErrJn
  579.  
  580. ************    Reads in a long word from file, returns (d0)
  581. * ReadLong *
  582. ************
  583. ReadLong
  584.     movem.l    d1-d3/a0/a1,-(sp)    save regs
  585.     move.l    FileHandle(pc),d1
  586.     move.l    #.Buffer,d2
  587.     moveq    #4,d3
  588.     CALLDOS    Read
  589.     cmp.l    #4,d0            read in 4 bytes ?
  590.     bne    ErrRead
  591.     move.l    .Buffer(pc),d0
  592.     addq.l    #4,FilePos
  593.  
  594.     movem.l    (sp)+,d1-d3/a0/a1    restore regs
  595.     rts
  596. .Buffer    dc.l    0
  597.  
  598. ***************    Reads in d0 long word from file, data in DiskBuffer onwards
  599. * ReadD0Longs *
  600. ***************
  601. ReadD0Longs
  602.     movem.l    d1-d3/a0/a1,-(sp)    save regs
  603.     lea    DiskBuffer(pc),a0
  604.     lsl.l    #2,d0
  605.     clr.b    0(a0,d0.w)        Null terminate data to read in
  606.     move.l    d0,-(sp)
  607.     add.l    d0,FilePos        advance file position
  608.  
  609.     move.l    FileHandle(pc),d1
  610.     move.l    #DiskBuffer,d2
  611.     move.l    d0,d3
  612.     CALLDOS    Read
  613.     cmp.l    (sp)+,d0        check number of bytes read in
  614.     bne    ErrRead
  615.     movem.l    (sp)+,d1-d3/a0/a1    restore regs
  616.     rts
  617.  
  618. ***************    Skips D0 long words past current file point
  619. * SkipD0Longs *
  620. ***************
  621. SkipD0Longs
  622.     movem.l    d0-d3/a0/a1,-(sp)
  623.     move.l    FileHandle(pc),d1
  624.     move.l    d0,d2
  625.     lsl.l    #2,d2
  626.     add.l    d2,FilePos        advance file position
  627.     moveq    #OFFSET_CURRENT,d3
  628.     CALLDOS    Seek
  629.     cmp.l    #-1,d0
  630.     beq    ErrRead
  631.     movem.l    (sp)+,d0-d3/a0/a1
  632.     rts
  633.  
  634. Title        dc.b    "Object dump utility V1.0 (C) 1993 Justin Leck",10,10,0
  635. BadOptMsg    dc.b    "Unknown option %c",10,0
  636. BadCLIMsg    dc.b    "USAGE:  Hunk [-s] <executable/object file>",10,10,0
  637. BadReadMsg    dc.b    "Error reading file.",10,10,0
  638. NoFileMsg    dc.b    "Can't read file '%s'.",10,10,0
  639. NoMemMsg    dc.b    "Not enough memory",10,10,0
  640. BreakMsg    dc.b    10,"*** BREAK ***",10,0
  641. DosName        DOSNAME
  642. HunkMsg        dc.b    "Hunk %d:    %x %s",10,0
  643. BadHunkMsg    dc.b    "Funny code: %x @ %x",10,0
  644. ForceMsg    dc.b    "** Hunk forcing type $%x **"
  645. BlankMsg    dc.b    0
  646. ToChipMsg    dc.b    "** Hunk forced to chip memory **",0
  647. ToFastMsg    dc.b    "** Hunk forced to fast memory **",0
  648.  
  649. NameMsg        dc.b    "%s - <%s>",10,0
  650.  
  651. HunkCodeDataMsg    dc.b    "    %s block %d bytes long.",10,0
  652. HunkReloc8Msg    dc.b    "8",0
  653. HunkReloc16Msg    dc.b    "16",0
  654. HunkReloc32Msg    dc.b    "32",0
  655. HunkRelocMsg    dc.b    "    Reloc %s for hunk %d with %d refs.",10,0
  656. HunkSymbolMsg    dc.b    "    Symbol table block.",10,0
  657. HunkExtMsg    dc.b    "    External symbol block.",10,0
  658. ExtRefMsg    dc.b    "      %d %d bit refs of <%s>",10,0
  659. ExtCommonMsg    dc.b    "      <%s> (%d refs) common size = %d",10,0
  660. ExtDefintionMsg    dc.b    "      %s = $%x",10,0
  661. EndUnit        dc.b    "End of object dump.",10,0
  662. HunkHeaderMsg    dc.b    "Executable File",10,0
  663. TableMsg    dc.b    "    Table contains %d Hunks",10,0
  664. TableRange    dc.b    "       First Hunk = %d, Last hunk = %d",10,0
  665. LibNameMsg    dc.b    "    Library - <%s>",10,0
  666. HunkOverlayMsg    dc.b    "Hunk Overlay",10
  667.         dc.b    "    Table size is %d words.",10
  668.         dc.b    "    Max number of overlay table uses is %d",10,0
  669. HunkBreakMsg    dc.b    "Hunk Break",10,0
  670.  
  671.  
  672. StartStack    dc.l    0
  673. Stack        dc.l    0    value of stack before a bsr printf
  674. DosBase        dc.l    0
  675. HandleOut    dc.l    0
  676. FileName    dc.l    0
  677. FileHandle    dc.l    0
  678. FilePos        dc.l    0
  679. FileSize    dc.l    0
  680. DiskBuffer    ds.b    256    256 bytes for symbol names etc
  681.  
  682. HunkNumber    dc.l    0
  683. SameHunk    dc.b    0    0 = new hunk, -1= same hunk number
  684. ShowSymbols    dc.b    0    0 = don't, !=0, show symbols
  685.  
  686.